package edu.hunau.cxb19.oop.class12.ex;

/**
 * 描述字符以及该字符出现的次数
 * 
 * @author hb
 *
 *         2020-03-11 14:41:08
 */
public class Counter {
	// 标识当前的字符
	private char c;
	// 标识当前字符出现的次数
	private int number;

	public Counter(char c, int number) {
		super();
		this.c = c;
		this.number = number;
	}

	@Override
	public String toString() {

		return c + ":" + number;
	}

	@Override
	public int hashCode() {
		return this.c;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (obj == this)
			return true;
		if (obj instanceof Counter) {
			Counter other = (Counter) obj;
			return this.c == other.c;
		}

		return false;
	}

	public Counter() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the c
	 */
	public char getC() {
		return c;
	}

	/**
	 * @param c the c to set
	 */
	public void setC(char c) {
		this.c = c;
	}

	/**
	 * @return the number
	 */
	public int getNumber() {
		return number;
	}

	/**
	 * @param number the number to set
	 */
	public void setNumber(int number) {
		this.number = number;
	}

}
